package com.geekaca.testthread.threadpool77;

import java.util.concurrent.*;

public class ThreadPoolDemo1 {
    public static void main(String[] args) {
        ArrayBlockingQueue waitQueue = new ArrayBlockingQueue<>(20);
        // 线程池创建
        ExecutorService threadPool = new ThreadPoolExecutor(5,
                10,
                10,
                TimeUnit.SECONDS,
                waitQueue,
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
        // 向线程池提交任务
        ZuocaiRunnable zuocai = new ZuocaiRunnable();
        threadPool.execute(zuocai);
        threadPool.execute(zuocai);
        threadPool.execute(zuocai);
        threadPool.execute(zuocai);
        threadPool.execute(zuocai);
        threadPool.execute(zuocai);
        threadPool.execute(zuocai);
        threadPool.shutdown();

    }
}
